package service;

import java.util.ArrayList;
import java.util.List;

import dao.OrderDao;
import dao.OrderDaoImpl;
import model.OrderDetail;
import model.Orders;



public class OrderServiceImpl implements OrderService {
	private OrderDao dao = new OrderDaoImpl();
	@Override
	public List<Orders> showAllList(int userId) {
		List<Orders> orders=new ArrayList<Orders>();
		orders=dao.getAllByUser(userId);
		return orders;
	}

	@Override
	public boolean buy(int uid,List<Integer> goodsId) {
		for (int i = 0; i < goodsId.size(); i++) {
			int num=dao.add(goodsId.get(i), uid);
			if (num>0) {
				return true;
			}
		}
		return false;
	}

}
